//
// Created by martin on 3/22/22.
//

#ifndef MUDUO_FTPREQUEST_H
#define MUDUO_FTPREQUEST_H

#include "muduo/base/copyable.h"
#include "muduo/base/Timestamp.h"

namespace ftp
{

class FtpRequest : public muduo::copyable
{
public:
    FtpRequest() = default;

    void setCommandName(const char* start, const char* end);

    const std::string& commandName() const
    { return commandName_; }

    void setCommandParam(const char* start, const char* end)
    { commandParam_.assign(start, end); }

    const std::string& commandParam() const
    { return commandParam_; }

    void setReceiveTime(muduo::Timestamp t)
    { receiveTime_ = t; }

    muduo::Timestamp receiveTime() const
    { return receiveTime_; }

    void swap(FtpRequest& other)
    {
        commandName_.swap(other.commandName_);
        commandParam_.swap(other.commandParam_);
        receiveTime_.swap(other.receiveTime_);
    }

private:
    std::string commandName_;
    std::string commandParam_;
    muduo::Timestamp receiveTime_;
};

} // namespace ftp

#endif //MUDUO_FTPREQUEST_H
